#ifndef MAIN_WINDOW_H
#define MAIN_WINDOW_H

#include <string>
#include <time.h>
#include <GLee.h>
#include <GL/gl.h>

#include "GLLib/text.h"
#include "MovieRenderer/movierenderer.h"


#ifdef WIN32
    #include "VideoOutput/wgloutputwindow.h"
#else
    #include "VideoOutput/glxvideooutput.h"
#endif

class MainWindow
{
public:
    MainWindow(std::string title, int width, int height, std::string filename = "");
    ~MainWindow();

private:
    bool init(std::string title, int width, int height, std::string filename);
    bool initGL();

    void destroy();

    void mainloop();
    void drawGL();
    void drawText(GL::Text& font);
    void resize(int width, int height);

    MovieRenderer*          m_pMovieRenderer;
    GL::Text                m_FpsText;

#ifdef WIN32
    WglOutputWindow         m_VideoOutput;
#else
    GlxVideoOutput          m_VideoOutput;
#endif

    std::string     m_Title;
    std::string     m_Filename;
    int             m_Width;
    int             m_Height;
    int             m_WindowedWidth;
    int             m_WindowedHeight;
    uint64          m_PrevIntervalTime;
    uint64          m_PrevTime;
    uint64          m_CurTime;
    bool            m_FullScreen;
    bool            m_Rotate;
    bool            m_StretchToFit;
    bool            m_Finished;
    int             m_Frames;
    bool            m_Paused;
};

#endif
